//package com.qzdatasoft.mcp.server.demo.rest;
//
//import com.qzdatasoft.mcp.server.common.IMcpToolProvider;
//import lombok.RequiredArgsConstructor;
//import org.springframework.ai.tool.annotation.Tool;
//import org.springframework.jdbc.core.JdbcTemplate;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//import java.util.List;
//import java.util.Map;
//import java.util.stream.Collectors;
//
//@RestController
//@RequiredArgsConstructor
//public class MySqlController implements IMcpToolProvider {
//
//    private final JdbcTemplate jdbcTemplate;
//    @GetMapping("/db/getAllTableName")
//    @Tool(description = "Return all table names in the database separated by comma.")
//    public String getAllTableName() {
//        List<Map<String,Object>> list = jdbcTemplate.queryForList("SELECT table_name FROM information_schema.tables WHERE table_schema = DATABASE()");
//        String headers = String.join(",", list.get(0).keySet());
//        return String.join(",", headers, list.stream()
//                .map(e -> e.values().iterator().next().toString())
//                .collect(Collectors.joining(",")));
//    }
//}
